﻿using System.Collections.Generic;
using Campari.Software;
using System;
using AspNetInfo.Core;
using System.Web;
using System.Data;

namespace AspNetInfo.Detectors
{
    public class FrameworkDetector : IDetector
    {
        public DataTable Detect(EnvironmentPermissions permissions)
        {
            var dt = DetectorHelper.MakeResultTable();
            if (permissions.TrustLevel > AspNetHostingPermissionLevel.Medium)
            {
                dt.Rows.Add("ASP.NET 1.0", InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx10).ToString());
                dt.Rows.Add("ASP.NET 1.1", InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx11).ToString());
                dt.Rows.Add("ASP.NET 2.0", InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx20).ToString());
                dt.Rows.Add("ASP.NET 3.0", InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx30).ToString());
                dt.Rows.Add("ASP.NET 3.5", InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx35).ToString());
                dt.Rows.Add("ASP.NET 4.0", InternetInformationServicesDetection.IsAspNetRegistered(FrameworkVersion.Fx40).ToString());
            }
            dt.Rows.Add("CLR Version", Environment.Version.ToString());
            return dt;
        }
        public string Name
        {
            get { return "ASP.NET Framework"; }
        }


        public string Description
        {
            get { return String.Empty;  }
        }

        public string TabName
        {
            get { return Tabs.AspNet; }
        }
    }
}
